﻿using System;
using System.Collections.Generic;
using DataService.Enums;
using DataService.Group;
using DataService.Structs;
using DataService.Tag;

namespace DataService.Interfaces;

public interface IDataServer : IDisposable
{
    TagBase this[short id] { get; }
    TagBase this[string name] { get; }
    ExpressionEval Eval { get; }
    object SyncRoot { get; }//对所有涉及集合更改项目使用；包括IGROUP的ADDITEMS
    IList<TagMetaData> MetaDataList { get; }
    IList<Scaling> ScalingList { get; }
    IEnumerable<IDriver> Drivers { get; }
    IEnumerable<string> BrowseItems(BrowseType browseType, string tagName, DataType dataType);
    IDriver AddDriver(short id, string name, string assembly, string className);
    IGroup GetGroupByName(string name);
    int GetScaleByID(short id);
    int GetItemProperties(short id);//返回的是元数据在元数据列表的索引
    bool RemoveDriver(IDriver device);
    bool AddItemIndex(string key, TagBase value);
    bool RemoveItemIndex(string key);
    void ActiveItem(bool active, params TagBase[] items);
    int BatchWrite(Dictionary<string, object> tags, bool sync);
    HistoryData[] BatchRead(DataSource source, bool sync, params TagBase[] itemArray);
}
